package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Ctschemes {
    private int ctId;//id
    private Integer ctWay;//回款方式
    private Date ctData;//回款计划还款日期yes
    private Integer ctLatestdata;//最后回款日期
    private Integer ctState;//是否已回款完毕//yes
    private Integer ctCustomerid;//客户id2yes
    private Integer ctUserid;//所有者yes
    private String ctNote;//备注9yes
    private OrderInfo orderInfoByOrderId;//
    private Collection<Ctschemesrecord> ctschemesrecordsByCtId;

    private Integer ctContractid;//合同yes
    private Integer ctPeriod;//ct_period//期次
    private Integer invoiceState;//invoice_state//是否需要发票
    private BigDecimal ctAmount;//ct_amount //金额
    private String ctThere;//回款主题
    private Integer ctApproverid;
    private Integer ctAppstate;
    private Date ctNewtime;

    @Id
    @Column(name = "ct_id")
    public int getCtId() {
        return ctId;
    }

    public void setCtId(int ctId) {
        this.ctId = ctId;
    }

    @Basic
    @Column(name = "ct_way")
    public Integer getCtWay() {
        return ctWay;
    }

    public void setCtWay(Integer ctWay) {
        this.ctWay = ctWay;
    }

    @Basic
    @Column(name = "ct_data")
    public Date getCtData() {
        return ctData;
    }

    public void setCtData(Date ctData) {
        this.ctData = ctData;
    }

    @Basic
    @Column(name = "ct_latestdata")
    public Integer getCtLatestdata() {
        return ctLatestdata;
    }

    public void setCtLatestdata(Integer ctLatestdata) {
        this.ctLatestdata = ctLatestdata;
    }

    @Basic
    @Column(name = "ct_state")
    public Integer getCtState() {
        return ctState;
    }

    public void setCtState(Integer ctState) {
        this.ctState = ctState;
    }

    @Basic
    @Column(name = "ct_customerid")
    public Integer getCtCustomerid() {
        return ctCustomerid;
    }

    public void setCtCustomerid(Integer ctCustomerid) {
        this.ctCustomerid = ctCustomerid;
    }


    @Basic
    @Column(name = "ct_userid")
    public Integer getCtUserid() {
        return ctUserid;
    }

    public void setCtUserid(Integer ctUserid) {
        this.ctUserid = ctUserid;
    }

    @Basic
    @Column(name = "ct_Note")
    public String getCtNote() {
        return ctNote;
    }

    public void setCtNote(String ctNote) {
        this.ctNote = ctNote;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Ctschemes ctschemes = (Ctschemes) o;
        return ctId == ctschemes.ctId &&
                Objects.equals(ctWay, ctschemes.ctWay) &&
                Objects.equals(ctData, ctschemes.ctData) &&
                Objects.equals(ctLatestdata, ctschemes.ctLatestdata) &&
                Objects.equals(ctState, ctschemes.ctState) &&
                Objects.equals(ctCustomerid, ctschemes.ctCustomerid) &&
                Objects.equals(ctUserid, ctschemes.ctUserid) &&
                Objects.equals(ctNote, ctschemes.ctNote);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ctId, ctWay, ctData, ctLatestdata, ctState, ctCustomerid, ctUserid, ctNote);
    }

    @ManyToOne
    @JoinColumn(name = "order_id", referencedColumnName = "order_id")
    public OrderInfo getOrderInfoByOrderId() {
        return orderInfoByOrderId;
    }

    public void setOrderInfoByOrderId(OrderInfo orderInfoByOrderId) {
        this.orderInfoByOrderId = orderInfoByOrderId;
    }

    @OneToMany(mappedBy = "ctschemesByCtId")
    public Collection<Ctschemesrecord> getCtschemesrecordsByCtId() {
        return ctschemesrecordsByCtId;
    }

    public void setCtschemesrecordsByCtId(Collection<Ctschemesrecord> ctschemesrecordsByCtId) {
        this.ctschemesrecordsByCtId = ctschemesrecordsByCtId;
    }


    @Basic
    @Column(name = "ct_contractid")
    public Integer getCtContractid() {
        return ctContractid;
    }

    public void setCtContractid(Integer ctContractid) {
        this.ctContractid = ctContractid;
    }

    @Basic
    @Column(name = "ct_period")
    public Integer getCtPeriod() {
        return ctPeriod;
    }

    public void setCtPeriod(Integer ctPeriod) {
        this.ctPeriod = ctPeriod;
    }

    @Basic
    @Column(name = "invoice_state")
    public Integer getInvoiceState() {
        return invoiceState;
    }

    public void setInvoiceState(Integer invoiceState) {
        this.invoiceState = invoiceState;
    }

    @Basic
    @Column(name = "ct_amount")
    public BigDecimal getCtAmount() {
        return ctAmount;
    }

    public void setCtAmount(BigDecimal ctAmount) {
        this.ctAmount = ctAmount;
    }


    @Override
    public String toString() {
        return "Ctschemes{" +
                "ctId=" + ctId +
                ", ctWay=" + ctWay +
                ", ctData=" + ctData +
                ", ctLatestdata=" + ctLatestdata +
                ", ctState=" + ctState +
                ", ctCustomerid=" + ctCustomerid +
                ", ctUserid=" + ctUserid +
                ", ctNote='" + ctNote + '\'' +
                ", orderInfoByOrderId=" + orderInfoByOrderId +
                ", ctschemesrecordsByCtId=" + ctschemesrecordsByCtId +
                ", ctContractid=" + ctContractid +
                ", ctPeriod=" + ctPeriod +
                ", invoiceState=" + invoiceState +
                ", ctAmount=" + ctAmount +
                '}';
    }


    @Basic
    @Column(name = "ct_there")
    public String getCtThere() {
        return ctThere;
    }

    public void setCtThere(String ctThere) {
        this.ctThere = ctThere;
    }

    @Basic
    @Column(name = "ct_approverid")
    public Integer getCtApproverid() {
        return ctApproverid;
    }

    public void setCtApproverid(Integer ctApproverid) {
        this.ctApproverid = ctApproverid;
    }

    @Basic
    @Column(name = "ct_appstate")
    public Integer getCtAppstate() {
        return ctAppstate;
    }

    public void setCtAppstate(Integer ctAppstate) {
        this.ctAppstate = ctAppstate;
    }

    @Basic
    @Column(name = "ct_newtime")
    public Date getCtNewtime() {
        return ctNewtime;
    }

    public void setCtNewtime(Date ctNewtime) {
        this.ctNewtime = ctNewtime;
    }
}
